<template>
    <div class="goodslistitems" @click='itemclick'>
       
            <img :src="showImage" alt="">
            <div class="goods-c">
                <span class="price">￥{{goodsItem.price}}</span>
                <img src="../../../assets/images/home/关注.svg" alt="">
                <span class="collect">{{goodsItem.cfav}}</span>
            </div>

            <span class="tl">{{goodsItem.title}}</span>

      
    </div>
</template>

<script>
export default {
    name:"GoodsListItems",
    props:{
        goodsItem:{
            type:Object,
            default(){
                return[]
            }
        }
    },
    methods:{
        imageload(){
            if(this.$route.path.indexOf('/index')){
                this.$emit('itemimageload')
            }

        },
        itemclick(){
            
            // include(detail)!==-1)
            if(this.$route.path.indexOf('detail')!==1){
                this.$router.push('/detail/'+ this.goodsItem.iid )
                console.log('跳转')
            }else 
            // if(this.$route.path.indexOf('detail')!==-1)
            {
                // this.$router.push('/detail/'+this.goodsItem.item_id)
                return false
                
            }

        }
    },
    computed:{
        showImage(){
            return (this.goodsItem.show && this.goodsItem.show.img) || this.goodsItem.image;
            // return(this.goodsItem.image || his.goodsItem.show.img)
        },

        // showPrise(){
        //     return (this.goodsItem.show && this.goodsItem.discountPrice || this.goodsItem.orgPrice)
        // }
       
    }

}
</script>


<style scoped>
.goodslistitems{
    width: 46%;
    margin-bottom: 2vw;
    margin-left: 2vw;
    margin-right: 2vw;
    margin-top: 2vw;
    cursor: pointer;

}
.goods-c{
    display: flex;

}

.goodslistitems img{
    width: 100%;
    border-radius: 4vw;
}
.goods-c img{
    width: 5vw;
}
.goodslistitems span{
    display: inline-block;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    word-break: keep-all;
    text-overflow: ellipsis;
    margin-top: 1vw;
}
.price{
    font-weight: bold;
}
</style>